﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Interactivity;

namespace Phone7ActionPack.Actions
{/*
    public class ChoosePhoneNumberAction : TargetedTriggerAction<FrameworkElement>
    {
        Microsoft.Phone.Tasks.PhoneNumberChooserTask task ;
        Microsoft.Phone.Tasks.SavePhoneNumberTask save = new Microsoft.Phone.Tasks.SavePhoneNumberTask();
        

        public string TargetProperty
        {
            get { return (string)GetValue(TargetPropertyProperty); }
            set { SetValue(TargetPropertyProperty, value); }
        }

        // Using a DependencyProperty as the backing store for TargetProperty.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TargetPropertyProperty =
            DependencyProperty.Register("TargetProperty", typeof(string), typeof(ChoosePhoneNumberAction), new PropertyMetadata("Text"));

        
        public ChoosePhoneNumberAction()
        {
            task = new Microsoft.Phone.Tasks.PhoneNumberChooserTask();
            Microsoft.Phone.Tasks.ChooserListener.ChooserCompleted += new EventHandler(ChooserListener_ChooserCompleted);
            
        }

        void ChooserListener_ChooserCompleted(object sender, EventArgs e)
        {
            var results = e as Microsoft.Phone.Tasks.TaskEventArgs<Microsoft.Phone.Tasks.PhoneNumberResult>;
            if(results !=null)
                if (results.TaskResult == Microsoft.Phone.Tasks.TaskResult.OK)
                {
                    this.Target.GetType().GetProperty(TargetProperty).SetValue(this.Target, results.Result.PhoneNumber, null);
                }

        }

        protected override void Invoke(object parameter)
        {
            //save.Show();
            task.Show();
            
        }
    }*/
}
